package com.fivestar.pmanager.dao.mapper;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import com.fivestar.pmanager.core.mapper.DBActionMapper;
import com.fivestar.pmanager.core.mapper.PaginatingMapper;
import com.fivestar.pmanager.model.SysRoleBean;

import java.util.List;
import java.util.Map;

/**
 * 角色
 * SysRoleMapper
 * @author 
 *
 */
@Repository("sysRoleMapper")
public interface SysRoleMapper extends DBActionMapper<SysRoleBean>,
        PaginatingMapper<SysRoleBean>
{

    /**
     * 根据关键字查询
     *
     * @param keyWord 关键字
     * @return
     */
    @Results({
            @Result(column = "row_id", property = "id"),
            @Result(column = "name", property = "text")
    })
    @Select("select row_id,name from sm_role where name like '%${keyWord}%' or code like '%${keyWord}%' and is_deleted=0")
    List<Map<String,Object>> findByKeyWord(@Param("keyWord")String keyWord);

}
